Add signatureHelp (parameter hints) to the LSP WebSocket API#358
Merged
Conversation
sourcekit-lsp (main) now implements textDocument/signatureHelp, so expose it: a `signatureHelp` method that forwards the cursor position and returns the SignatureHelp response (signatures, parameters, activeParameter) to the client. This backs Xcode-style parameter hints in the editor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes LSP textDocument/signatureHelp through the existing WebSocket bridge so the SwiftFiddle editor can request and display parameter hints (signatures/parameters/activeParameter) from sourcekit-lsp.
Changes:
- Add a new WebSocket
signatureHelpmethod handler that forwards to the language server and returns{ method, id, value }. - Add
LanguageServer.sendSignatureHelpRequest(documentPath:line:character:)to issueSignatureHelpRequestover the JSON-RPC connection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Sources/App/routes.swift | Adds signatureHelp request/response message types and a WebSocket route case that forwards the request and returns the LSP response payload. |
| Sources/App/Controllers/LanguageServer.swift | Adds a helper to send SignatureHelpRequest to sourcekit-lsp using the existing JSONRPCConnection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes
textDocument/signatureHelpover the WebSocket bridge so the editor can show Xcode-style parameter hints.sourcekit-lsp on
mainnow implements signature help (SwiftLanguageService/SignatureHelp.swift), so this just wires it through:LanguageServer.sendSignatureHelpRequest(documentPath:line:character:)issuestextDocument/signatureHelp.routes.swifthandles a newsignatureHelpWebSocket method and returns{ method, id, value }wherevalueis the LSPSignatureHelp(signatures / parameters / activeParameter).Verified end-to-end against a locally rebuilt image: for
greet(name: String, times: Int), requesting signature help inside the call returns the signature label and parameter ranges, andactiveParametercorrectly advances from0to1as the cursor moves past the comma.The companion frontend change (Monaco
registerSignatureHelpProvider+ thesignatureHelprequest, plus completion-trigger improvements) is in SwiftFiddle/swiftfiddle-web#1234.🤖 Generated with Claude Code